﻿
GO

/****** Object:  Table [dbo].[LogData]    Script Date: 12/11/2011 10:58:21 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[LogData](
	[LogId] [bigint] IDENTITY(1,1) NOT NULL,
	[CurrentDate] [datetime] NOT NULL,
	[BillDate] [datetime] NOT NULL,
	[UserBill] [bigint] NOT NULL,
	[Type] [int] NOT NULL,
	[Number] [nvarchar](50) NOT NULL,
	[Contents] [nvarchar](max) NOT NULL,
	[OldQuantity] [float] NOT NULL,
	[NewQuantity] [float] NOT NULL,
	[MoneyOrPrice] [money] NOT NULL,
	[Status] [bit] NOT NULL,
	[UserName] [nvarchar](255) NOT NULL,
	[CounterId] [bigint] NOT NULL,
	[TimeStamp] [timestamp] NOT NULL,
	[ClientCode] [nvarchar](255) NULL,
	[SyncCode] [nvarchar](255) NULL,
	[TimeStampCode] [varbinary](8) NULL,
 CONSTRAINT [PK_LogData] PRIMARY KEY CLUSTERED 
(
	[LogId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'1: Xóa phiếu - 2: Sửa chi tiết - 3: Xóa chi tiết' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'LogData', @level2type=N'COLUMN',@level2name=N'Type'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Nếu la bill thì = 0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'LogData', @level2type=N'COLUMN',@level2name=N'OldQuantity'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Nếu la bill thì = 0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'LogData', @level2type=N'COLUMN',@level2name=N'NewQuantity'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Nếu là bill thì là tổng tiền trên bill; Nếu là chi tiết thì là giá của chi tiết' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'LogData', @level2type=N'COLUMN',@level2name=N'MoneyOrPrice'
GO

ALTER TABLE [dbo].[LogData] ADD  CONSTRAINT [DF_LogData_OldQuantity]  DEFAULT ((0)) FOR [OldQuantity]
GO

ALTER TABLE [dbo].[LogData] ADD  CONSTRAINT [DF_LogData_NewQuantity]  DEFAULT ((0)) FOR [NewQuantity]
GO


